<template>
  <van-cell title="用户名" is-link :value="user.username" @click="toEdit('username','用户名',user.username)"/>

  <van-cell title="头像" is-link>
    <img style="height: 50px" :src="user.avatarUrl" alt="头像" @click="toEdit('avatarUrl','头像',user.avatarUrl)"/>

  </van-cell>
  <van-cell title="性别" is-link :value="`${user.gender===0?'女':'男'}`"
            @click="toEdit('gender','性别',`${user.gender===0?'女':'男'}`)"/>
  <van-cell title="电话" is-link :value="user.phone" @click="toEdit('phone','手机号',user.phone)"/>
  <van-cell title="邮箱" is-link :value="user.email" @click="toEdit('email','邮箱',user.email)"/>
</template>


<script setup>
import router from "../router/index.js";
import {useUserStore} from "../store/userStore.js";
import {ref} from "vue"


const userStore = useUserStore()
const user = ref(userStore.userInfo)


const toEdit = (editKey, editName, currentValue) => {
  router.push({
    path: '/editInfo',
    query: {
      editKey,
      editName,
      currentValue
    }
  })
}


</script>
<style scoped>

</style>